package cn.edu.nwafu.hjpg.service.impl;

import cn.edu.nwafu.hjpg.dao.ProveDao;
import cn.edu.nwafu.hjpg.entity.Prove;
import cn.edu.nwafu.hjpg.service.ProveService;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class ProveServiceImpl implements ProveService {
    final ProveDao proveDao;

    public ProveServiceImpl(ProveDao proveDao) {
        this.proveDao = proveDao;
    }

    @Override
    public String addProve(Prove prove) {
        return proveDao.insert(prove).getCasNo();
    }

    @Override
    public String delProve(Prove prove) {
        proveDao.delete(prove);
        return "1";
    }

    @Override
    public List<Prove> findByCas(String cas) {
        return proveDao.findAllByCasNo(cas);
    }

    @Override
    public Prove findByCasFilename(String cas, String filename) {
        //
        return proveDao.findProveByCasNoAndFileNameLike(cas,filename);
    }
}
